<?php
function db_register_subscriber_template()
{
	$output ='
	<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
		<html>
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Register Subscriber Mail</title>
		</head>
		<style>
			body
			{
				width:800px;
				margin:0 auto;		
			}
			a
			{
				text-decoration:none;
				color:#847f7f;
				font-style:italic;
				font-weight:bold;		
			}
			table
			{
				margin-left:30px;
				font-family:arial;
				font-size:14px;
			}
			.first
			{
				width:80px;
				font-weight:bold;
			}
			.second
			{
				font-style:italic;
			}
		</style>
		<body>
			<h2> Welcom to <a href="'.get_bloginfo("home").'">'.get_bloginfo("blogname").'</a></h2>
			<p>Thank you register subscriber at <a href="'.get_bloginfo("home").'">'.get_bloginfo("blogname").'</a></p>
			<p>For UnRegister subscriber please access <a href="'.get_bloginfo("home").'/unsubscriber">Unsubscriber</a></p>
			<p><b>Note :</b> This is auto email,Please not reply this is email! ,please not delete this email.This email will be for Unsubscriber. </p>
			<p>Support </p>
			<hr>
			<table>
				<tr>
					<td class="first"> Date:</td>
					<td class="second"> '.get_the_date("Y-m-d").'</td>
				</tr>
				<tr>
					<td class="first"> Send by:</td>
					<td class="second"> '.get_option("mySetting_company_name").'</td>
				</tr>
				<tr>
					<td class="first"> Address:</td>
					<td class="second"> '.get_option("mySetting_company_address").'</td>
				</tr>
				<tr>
					<td class="first"> Tel:</td>
					<td class="second"> '.get_option("mySetting_company_tel").'</td>
				</tr>
				<tr>
					<td class="first"> Email:</td>
					<td class="second"> '.get_option("mySetting_company_email").'</td>
				</tr>
			</table>
			
		</body>
		</html>
	';
	return $output;
}

function db_subscriber_send_email($email)
{	
		//include TEMPLATEPATH.'/incs/subscriber/subscriber_mail_template.php';
		$template = db_register_subscriber_template();
		$to=$email;
	    $subject="Subcriber newsletter at ".$_SERVER['HTTP_HOST'];
	    
		$headers = array(
	        'From: '.get_bloginfo('name').' <'.get_option('admin_email').'>',
	        "Content-Type: text/html"
	    );
	    
		$h = implode("\r\n",$headers) . "\r\n";	
		if(wp_mail($to, $subject, $template,$h))
			return TRUE;
		else 
			return  FALSE;	
}